<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
    <title>ShellCheck: SC2127 – To use `${ ..; }`, specify `#!/usr/bin/env ksh`.</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
  </head>
  <body style="margin-left: auto; margin-right: auto; max-width: 800px">
    <h1>SC2127 – ShellCheck Wiki</h1>
    <a href="https://github.com/koalaman/shellcheck/wiki/SC2127">See this page on GitHub</a>
    <p style="display: none"><a href="index.html">Sitemap</a></p>
    <hr />
    <h2 id="to-use----specify-usrbinenv-ksh">To use <code>${ ..; }</code>,
specify <code>#!/usr/bin/env ksh</code>.</h2>
<p>(Or "To use cases with <code>;;&amp;</code>, specify
<code>#!/usr/bin/env bash</code>)</p>
<h3 id="problematic-code">Problematic code:</h3>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="SC2127.html#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/usr/bin/env bash</span></span>
<span id="cb1-2"><a href="SC2127.html#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="va">var</span><span class="op">=</span><span class="va">${</span><span class="er"> mycmd; </span><span class="va">}</span><span class="kw">;</span></span></code></pre></div>
<p>or</p>
<pre><code>#!/usr/bin/env ksh
case &quot;$1&quot; in
  foo) echo &quot;Foo!&quot; ;;&amp;
  f*) echo &quot;F-something at least&quot; ;;
esac</code></pre>
<h3 id="correct-code">Correct code:</h3>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="SC2127.html#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/usr/bin/env ksh</span></span>
<span id="cb3-2"><a href="SC2127.html#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="va">var</span><span class="op">=</span><span class="va">${</span><span class="er"> mycmd; </span><span class="va">}</span><span class="kw">;</span></span></code></pre></div>
<p>or</p>
<pre><code>#!/usr/bin/env bash
case &quot;$1&quot; in
  foo) echo &quot;Foo!&quot; ;;&amp;
  f*) echo &quot;F-something at least&quot; ;;
esac</code></pre>
<h3 id="rationale">Rationale:</h3>
<p>You are using a shell syntax feature not supported by the script's
shell. Either rewrite the construct, or switch to a different shell
interpreter.</p>
<h3 id="exceptions">Exceptions:</h3>
<p>None</p>
<h3 id="related-resources">Related resources:</h3>
<ul>
<li>Help by adding links to BashFAQ, StackOverflow, man pages, POSIX,
etc!</li>
</ul>
    <hr />
    <p style='font-size: 80%'><a href="../index.html">ShellCheck</a> is a static analysis tool for shell scripts. This page is part of its documentation.</p>
  </body>
</html>


